<template>
  <div>
    <div class="box">
      <div ref="box2" class="box2" />
    </div>
  </div>
</template>
<script>
export default {
  created() {
    document.addEventListener('click', (e) => {
      // e.target
      // pink色盒子 this.$refs.box2
      console.log('点击了:', this.$refs.box2.contains(e.target))
    })
  }

}
</script>
<style lang="scss" scoped>
    .box{
      width: 500px;
      height: 500px;
      border:5px solid red;
      .box2{
        width: 200px;
        height: 200px;
        background-color: pink;
      }
    }

</style>
